// 清除新版本已弃用的依赖

const init = () => {

    console.log('当前版本 1.0.0');
    console.log('versionUpdateInit run...');

    // 新版本已弃用游客玩家储存记录 仅登录用户可储存记录
    localStorage.removeItem('record')
    localStorage.removeItem('userInfo')


    // 删除localStorage中tetrisConfig的autoPause字段 该字段已弃用
    const tetrisConfig = localStorage.getItem('tetrisConfig')
    if (tetrisConfig) {
        const tetrisConfigObj = JSON.parse(tetrisConfig)
        if (tetrisConfigObj.hasOwnProperty('autoPause')) {
            delete tetrisConfigObj.autoPause
        }
        // 删除不明原因混入localStorage的tetrisConfig中的gravity
        if (tetrisConfigObj.hasOwnProperty('gravity')) {
            delete tetrisConfigObj.gravity
        }
        localStorage.setItem('tetrisConfig', JSON.stringify(tetrisConfigObj))
    }

}

init()